import java.util.LinkedList;
import java.util.Queue;

import net.mindview.util.TextFile;

public class E27_Queue {
	
	public static void main(String[] args) {
		
		Queue<Command> queue = new LinkedList<Command>();
		for(String word:new TextFile("src/E27_Queue.java","\\W+")){
			queue.add(new Command(word));
		}
		Consumer.consume(queue);
		
	}
	

}

class Command {
	private final String str;

	public Command(String str) {
		this.str = str;
	}

	public void operation() {
		System.out.println(str);
	}
}

class Consumer{
	public static void consume(Queue<Command> queue){
		while(queue.peek()!=null){
			queue.poll().operation();
		}
		
	}
}
